// --------------------------------------------------------------------------------------------------------------------
// <copyright file="StringFormatMethodAttribute.cs" company="CSLib.Net Team">
//   Copyright (c) Roman "4ux-nbIx" Novitsky 2010
// </copyright>
// <summary>
//   Indicates that marked method builds string by format pattern and (optional) arguments.
//   Parameter, which contains format string, should be given in constructor.
//   The format string should be in  -like form.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace CSLib.Net.Annotations
{
  #region Namespace Imports

  using System;

  #endregion


  /// <summary>
  /// Indicates that marked method builds string by format pattern and (optional) arguments. 
  /// Parameter, which contains format string, should be given in constructor.
  /// The format string should be in <see cref="string.Format(IFormatProvider,string,object[])"/> -like form.
  /// </summary>
  [AttributeUsage(AttributeTargets.Constructor | AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
  public sealed class StringFormatMethodAttribute : Attribute
  {
    #region Constants and Fields

    private readonly string _formatParameterName;

    #endregion


    #region Constructors and Destructors

    /// <summary>
    /// Initializes a new instance of the <see cref="StringFormatMethodAttribute"/> class. 
    /// Initializes new instance of StringFormatMethodAttribute.
    /// </summary>
    /// <param name="formatParameterName">
    /// Specifies which parameter of an annotated method should be treated as format-string.
    /// </param>
    public StringFormatMethodAttribute(string formatParameterName)
    {
      _formatParameterName = formatParameterName;
    }

    #endregion


    #region Properties

    /// <summary>
    /// Gets format parameter name.
    /// </summary>
    /// <value>
    /// The name of the format parameter.
    /// </value>
    public string FormatParameterName
    {
      get
      {
        return _formatParameterName;
      }
    }

    #endregion
  }
}